package com.yueya.api.stay;

import java.util.Map;

import com.jfinal.aop.Clear;
import com.jfinal.aop.Duang;
import com.jfinal.kit.JsonKit;
import net.sf.json.JSONObject;

import com.yueya.api.bed.IBedService;
import com.yueya.common.action.ApiController;
import com.yueya.common.model.Resp;

/**
 * 入住管理
 * 
 * @author todd
 * 
 */
public class IStayController extends ApiController {

	public void index() {
	}

	// 获取列表
	public void getPageList() {
		JSONObject jo = this.getJson();
		Resp r = Duang.duang(IStayService.class).getPageList(jo);
		renderJson(JsonKit.toJson(r));
	}

	// 获取明细
	public void getDetail() {
		JSONObject jo = this.getJson();
		Resp r= Duang.duang(IStayService.class).getDetail(jo);
		renderJson(JsonKit.toJson(r));
	}
	
	// 添加
	public void save() {
		JSONObject jo = this.getJson();
		jo.put("userid", getUserId());
		Resp resp = Duang.duang(IStayService.class).save(jo);
		renderJson(JsonKit.toJson(resp));
	}

	
	// 添加
	public void update() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IStayService.class).update(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	// 删除
	public void delete() {
		JSONObject jo = this.getJson();
		Resp resp = Duang.duang(IStayService.class).delete(jo);
		renderJson(JsonKit.toJson(resp));
	}

	// 退住
	public void stayLeave() {
		JSONObject jo = this.getJson();
		jo.put("userid", getUserId());
		Resp resp = Duang.duang(IStayService.class).stayLeave(jo);
		renderJson(JsonKit.toJson(resp));
	}
	
	

}
